In general, a method called a stereo method is widely known as a method of taking an image of a measurement target (hereinafter simply called a work) by a camera and finding coordinates of a three-dimensional point of the work based on the taken image. This stereo method is to measure a three-dimensional position using a parallax of a camera. Firstly between images taken by two cameras with different points of view are find corresponding points of a point to be measured about a three-dimensional position. Then, the three-dimensional position is calculated based on the principle of triangulation using the positional relations among the corresponding points on these images and the positions of the cameras.
Such a stereo method is widely used for three-dimensional measurement techniques used for product examination or for recognition of a work by an industrial robot, for example, and is used to calculate the formula of a three-dimensional straight line of a linear edge (linear portion) of the work, for example.
That is, in the case where design data on a work is known, when two or more of the three-dimensional formulae of straight-lines of the linear edges of the work are calculated so as to decide the posture of the work, then a three-dimensional position of the work can be found from the design data or the like in principle. Then, these three-dimensional formulae of straight-lines of the linear portions are calculated using three-dimensional positions of two or more points on the linear portions, and the above stereo method is used to calculate the positions of the points on the linear portions.
Unlike the case of finding the three-dimensional position of a point-like object, however, in the case of one point on a straight line of an image taken by one camera, it is difficult to specify a point corresponding to the one point on a straight line of an image taken by the other camera.
Then, in order to detect a corresponding point of the linear portion in each image plane, it is known to use a virtual reference line called an epipolar line. This epipolar line is obtained by projecting a line of sight about an object (e.g., one point on a linear portion of a work) viewed by one of the cameras onto an image taken by the other camera, and the corresponding point to be found can be said to reside on this epipolar line. Accordingly, in order to specify, as for one point on a linear portion on one image, a corresponding point on the other image, an epipolar line may be drawn on the other image and a cross point of the epipolar line with the linear portion of the other image can be made the corresponding point.
This epipolar line, however, is projected onto an image plane as a straight line where a plane (an epipolar plane) including the points of view of two cameras and a point on the work crosses each image plane, and therefore the gradient thereof will be uniquely decided by the positional relation between the two cameras. As a result, in the case of a linear portion having the gradient parallel to this epipolar line, a corresponding point cannot be specified because the epipolar line and the linear portion overlap.
Further when the cross angle between the epipolar line and the linear portion is close to parallel on the image, influences of the detection error of the corresponding point becomes significant compared with an error of the detection of the liner portion on the image, and so there is a possibility to decrease in measurement accuracy, especially in measurement accuracy in the depth direction.
Then, conventionally proposed is a technique of using an operator to extract a linear portion having a cross angle close to a right angle with respect to the epipolar line, thus extracting only a linear portion having a sufficient relative angle with respect to the epipolar line (see PTL 1).